package com.hengpeng.itfin.persist.impl;

import java.util.List;

import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Repository;

import com.hengpeng.common.persist.AbstractDao;
import com.hengpeng.common.persist.query.DynamicQuery;
import com.hengpeng.itfin.persist.ReceivePlanDao;
import com.hengpeng.itfinbase.persist.ReceivePlan;

@Repository
@Lazy
public class ReceivePlanDaoImpl extends AbstractDao<ReceivePlan> implements ReceivePlanDao {
	@Override
	public ReceivePlan getLatestReceivePlans(Long investInfoId) {
		DynamicQuery query = new DynamicQuery(ReceivePlan.class);
		if (investInfoId != null) {
			query.eq("investmentInfoId", investInfoId);
		}
		query.desc("curRecNum");
		List<ReceivePlan> dataList = super.findAllByDynamicQuery(query);
		return dataList != null && dataList.size() > 0 ? dataList.get(0) : null;
	}
	
}
